﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using ZombieMonkeys.Vibria.Logic;
using DataLayer;
using System.Xml.Linq;

namespace ZombieMonkeys.Vibria
{
    public partial class Load : PhoneApplicationPage
    {
        /// <summary>
        /// Instatiates the load game page
        /// </summary>
        public Load()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Confirm with the user that they want to delete an item and then delete
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteButton_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("Are you sure you want to delete?");
        }

        private void loadButton_Click(object sender, RoutedEventArgs e)
        {
            Uri game = new Uri(string.Format("/GridView.xaml?parameter={0}&Id={1}", "Load",(LoadList.SelectedIndex+1)), UriKind.Relative);
            NavigationService.Navigate(game);
        }

        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            PuzzleLoader loader = new PuzzleLoader();
            LoadList.ItemsSource = loader.LoadList();
        }
    }
}